from django.http import HttpResponse
from django.shortcuts import render

# Create your views here.
from App3.task import hello_world, send_a_mail, sum_ent


def exec_tasks(request):
    #test1
    # hello_world.delay(4)  #把任务添加到任务队列
    #test2：邮件发送
    # send_a_mail.delay({
    #     'subject':'中美外交会议观后感',
    #     'message':'no zuo no die',
    #     'recipient_list':['2066861081@qq.com']
    # })
    #test3:异步获取任务结果
    sum_ent.delay(100)  #求100之间的偶数和
    return HttpResponse("celery")

#获取异步任务的结果

def handle_log(request):
    print(1/0)
    return HttpResponse('日志')